Component({
    data: {
      button1: [
          { id: 1, name: '单价',checked:true }, 
          { id: 2, name: '毛利',checked:false }
      ],
      button2: [
          { id: 1, name: '当日',checked:true }, 
          { id: 2, name: '当月',checked:false }, 
          { id: 3, name: '当年',checked:false }
      ],
      button3: [
          { id: 1, name: '毛利额',checked:true }, 
          { id: 2, name: '毛利率',checked:false }
      ],
      tableHeader: [
        {
          prop: 'sale_name',
          width: 320,
          label: '销售单位',
          color: 'blue'
        },
        {
          prop: 'difference',
          width: 210,
          label: '差额'
        },
        {
          prop: 'rate',
          width: 210,
          label: '单数占比'
        }
      ],
      stripe: true,
      border: true,
      outBorder: true,
      row: [
        {
          "id": 1,
          "sale_name": "业务一部",
          "repayment_money": 100,
          "ok_money": 50,
          "delay_money": 800,
          "repayment_rate": 0.5,
        }, 
        
      ],

    },
    methods: {

        radioButtonTap1: function (e) {
            let id = e.currentTarget.dataset.id
            for (let i = 0; i < this.data.button1.length; i++) {
              if (this.data.button1[i].id == id) {
                //当前点击的位置为true即选中
                this.data.button1[i].checked = true;
              }
              else {
                //其他的位置为false
                this.data.button1[i].checked = false;
              }
            }
            this.setData({
              button1: this.data.button1,
              
            })
            
          },
    
          radioButtonTap2: function (e) {
            let id = e.currentTarget.dataset.id
            for (let i = 0; i < this.data.button2.length; i++) {
              if (this.data.button2[i].id == id) {
                //当前点击的位置为true即选中
                this.data.button2[i].checked = true;
              }
              else {
                //其他的位置为false
                this.data.button2[i].checked = false;
              }
            }
            this.setData({
              button2: this.data.button2,
              
            })
            
          },

          radioButtonTap3: function (e) {
            let id = e.currentTarget.dataset.id
            for (let i = 0; i < this.data.button3.length; i++) {
              if (this.data.button3[i].id == id) {
                //当前点击的位置为true即选中
                this.data.button3[i].checked = true;
              }
              else {
                //其他的位置为false
                this.data.button3[i].checked = false;
              }
            }
            this.setData({
              button3: this.data.button3,
              
            })
        
          },
        
    },

})